
//
//  ConOrReDetailGoodsSellCell.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/8/6.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "ConOrReDetailGoodsSellCell.h"
#import "ConOrReDetailModel.h"

@interface ConOrReDetailGoodsSellCell()
@property (weak, nonatomic) IBOutlet UILabel *sellStateLabel;
@property (weak, nonatomic) IBOutlet UIButton *btn;
@property (weak, nonatomic) IBOutlet UILabel *lookLogisticsLabel;
@property (weak, nonatomic) IBOutlet UIImageView *goodImgV;
@property (weak, nonatomic) IBOutlet UILabel *goodTitle;
@property (weak, nonatomic) IBOutlet UILabel *goodPrice;
@end


@implementation ConOrReDetailGoodsSellCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self setupSubViews];
}

- (void)setupSubViews{
    
    self.sellStateLabel.layer.masksToBounds = YES;
    self.sellStateLabel.layer.cornerRadius = 20/2;
    self.sellStateLabel.layer.borderWidth = 1;
   
    //    UIColorFromRGB(0x999999)
    self.btn.layer.masksToBounds = YES;
    self.btn.layer.cornerRadius = 30/2;
    self.btn.layer.borderWidth = 1;
    self.btn.layer.borderColor = [UIColor clearColor].CGColor;
    
    self.lookLogisticsLabel.layer.masksToBounds = YES;
    self.lookLogisticsLabel.layer.cornerRadius = 20/2;
    self.lookLogisticsLabel.layer.borderWidth = 1;
    self.lookLogisticsLabel.layer.borderColor = UIColorFromRGB(0x52A95B).CGColor;
}
- (void)setupGoodsInfo:(ConOrReGoodsModel *)model{

    if ([model.goods_status integerValue] == 1) {
        self.sellStateLabel.text =  @"出售中";
        self.lookLogisticsLabel.hidden = YES;
        self.btn.hidden = NO;
        self.sellStateLabel.textColor =  UIColorFromRGB(0xFF0000);
        self.sellStateLabel.layer.borderColor = UIColorFromRGB(0xFF0000).CGColor;
    }else if ([model.goods_status integerValue] == 2){
        self.lookLogisticsLabel.hidden = YES;
        self.btn.hidden = YES;
        self.sellStateLabel.text =  @"已售出";
        self.sellStateLabel.textColor =  UIColorFromRGB(0x999999);
        self.sellStateLabel.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
    } else if ([model.goods_status integerValue] == 10){
        self.lookLogisticsLabel.hidden = NO;
        self.btn.hidden = YES;
        self.sellStateLabel.text =  @"已寄回";
        self.sellStateLabel.textColor =  UIColorFromRGB(0x999999);
        self.sellStateLabel.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
    }
    
    self.goodPrice.text = [NSString stringWithFormat:@"实际出售价格:%@",model.price];
    self.goodTitle.text = model.goods_name;
    if (model.img_list && model.img_list.count > 0) {
        [self.goodImgV yy_setImageWithURL:[NSURL URLWithString:model.img_list.firstObject] placeholder:nil];
    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)urgentAction:(id)sender {
    
    if (self.btnBlock) {
        self.btnBlock(self.indexPath);
    }
}

@end
